<?php


namespace app\shop\command;


use app\enterprise\model\Message;
use app\shop\common\consts\Consts;
use app\shop\model\order\OrderModel;
use app\shop\model\user\MessageModel;
use app\shop\service\config\ConfigService;
use Carbon\Carbon;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use yunwuxin\cron\Task;

class ReplyMessageRemind extends Task
{
    protected function configure()
    {
        $this->everyMinute();
    }

    protected function execute()
    {
//        $configInfo = ConfigService::getConfigValue('sysInfo');
//        $interval = $configInfo['no_reply_interval'] ?? 60;
//        $list = MessageModel::where('from_user_role_id', Consts::CUSTOMER_ID)
//            ->whereIn('to_user_role_id', [Consts::DESIGN_ID, Consts::DESIGN_LEADER_ID])
//            ->where('create_time', '<=', time() - $interval)
//            ->where('is_last', 1)
//            ->where('is_undo', 0)
//            ->where('status', 1)
//            ->where('reply_status', 0)
//            ->where('type', '<>', 'system')
//            ->select();
//        foreach ($list as $v) {
//            $info = MessageModel::find($v['msg_id']);
//            $info->reply_status = 1;
//            $info->save();
//            $message = Message::createMessageData($v['from_user'], $v['to_user'], 'system', '请及时回复客户消息');
//            $message['del_user'] = $v['from_user'];
//            $message['order_id'] = $v['order_id'];
//            Message::sendMessage($message);
//            print "****************回复消息提醒执行完毕******************\n";
//        }
    }
}